﻿@page "/user"
@namespace SwashbucklerDiary.Rcl.Pages
@inherits ImportantComponentBase

<MyAppBar Title="@(I18n.T("User.Title"))"
          OnClick="NavigateToBack">
</MyAppBar>

<ScrollContainer>
    <MCard Class="my-list-card"
           Elevation="0"
           Rounded="@("lg")">
        <MList>
            <MListItem OnClick="()=>showEditAvatar=true">
                <MListItemIcon>
                    <MIcon Class="evident-icon">
                        mdi-account-circle-outline
                    </MIcon>
                </MListItemIcon>

                <MListItemContent>
                    @(I18n.T("User.Avatar.Name"))
                </MListItemContent>

                <MListItemAction>
                    <MAvatar Rounded="@("lg")"
                             Size="32">
                        <img class="user-avatar" src="@avatar" />
                    </MAvatar>
                    <MIcon>mdi-chevron-right</MIcon>
                </MListItemAction>
            </MListItem>

            <MDivider Class="mx-5"></MDivider>

            <MListItem OnClick="()=>showEditUserName=true">
                <MListItemIcon>
                    <MIcon Class="evident-icon">
                        mdi-account-details-outline
                    </MIcon>
                </MListItemIcon>

                <MListItemContent Class="flex-basic-space">
                    @(I18n.T("User.UserName.Name"))
                </MListItemContent>

                <MListItemContent>
                    <MListItemSubtitle Class="text-right">
                        @UserName
                    </MListItemSubtitle>
                </MListItemContent>

                <MListItemAction>
                    <MIcon>mdi-chevron-right</MIcon>
                </MListItemAction>
            </MListItem>

            <MDivider Class="mx-5"></MDivider>

            <MListItem OnClick="()=>showEditSign = true">
                <MListItemIcon>
                    <MIcon Class="evident-icon">
                        mdi-file-sign
                    </MIcon>
                </MListItemIcon>

                <MListItemContent Class="flex-basic-space">
                    <MListItemTitle>
                        @(I18n.T("User.Sign.Name"))
                    </MListItemTitle>
                </MListItemContent>

                <MListItemContent>
                    <MListItemSubtitle Class="text-right" Style="-webkit-line-clamp: 2;">
                        @Sign
                    </MListItemSubtitle>
                </MListItemContent>

                <MListItemAction>
                    <MIcon>mdi-chevron-right</MIcon>
                </MListItemAction>
            </MListItem>
        </MList>
    </MCard>
</ScrollContainer>

<MultiListDialog @bind-Visible="showEditAvatar"
                 Title="@(I18n.T("User.EditAvatar"))"
                 DynamicListItems="editAvatarMethods">
</MultiListDialog>

<InputDialog @bind-Visible="showEditUserName"
             Text="@UserName"
             Title="@(I18n.T("User.EditUserName"))"
             Placeholder="@(I18n.T("User.UserNamePlace"))"
             OnOK="SaveUserName">
</InputDialog>

<InputDialog @bind-Visible="showEditSign"
             MultiLine
             Text="@Sign"
             Title="@(I18n.T("User.EditSign"))"
             MaxLength="100"
             Placeholder="@(I18n.T("User.SignPlace"))"
             OnOK="SaveSign">
</InputDialog>
